<?php

class Authorization extends Eloquent
{
    protected $table = 'authorization';

    public function createOrUpdate(array $values)
    {
        $id = $values['id'];

        $exists = $this->find($id);

        if (! $exists) {
            $this->id = $id;
            $this->username = $values['username'];
            $this->password = $values['password'];
            $this->save();
            return;
        }

        return $this->where('id', '=', $id)->update($values);
    }
}